<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"  %>
<!DOCTYPE html>

<head>
    <meta charset="utf-8">
    <!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><![endif]-->
    <title>大乱斗后台</title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <meta name="viewport" content="width=device-width">
    <link href="http://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
    <link href="http://cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="/dld/admin/css/template_main.css">
</head>

<body>
	<jsp:include page="../common/header.jsp"></jsp:include>
        <!--/.navbar-collapse -->
        <div class="templatemo-content-wrapper">
            <div class="templatemo-content">
				<form class="form-horizontal"action="adminEditSubmitMsgMngAction" method="post">
				  <div class="form-group" style="display:none;">
				    <label for="username" class="col-sm-2 control-label">id</label>
				    <div class="col-sm-10">
				      <input type="text" class="form-control" id="id" name="msgEdit.id" value="${msgEdit.id}">
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="title" class="col-sm-2 control-label">主题</label>
				    <div class="col-sm-10">
				      <input type="text" class="form-control" id="title" name="msgEdit.title" value="${msgEdit.title}">
				      <div class="alert alert-danger title-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="img_url" class="col-sm-2 control-label">封面</label>
				    <div class="col-sm-10">
				      <input type="text" class="form-control" id="img_url" name="msgEdit.img_url" value="${msgEdit.img_url}">
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="content" class="col-sm-2 control-label">内容</label>
				    <div class="col-sm-10">
				      <script id="content" name="msgEdit.content" type="text/plain">${msgEdit.content}</script>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="read_num" class="col-sm-2 control-label">浏览</label>
				    <div class="col-sm-10">
				      <input type="number" class="form-control" name="msgEdit.read_num" id="read_num" value="${msgEdit.read_num}">
				      <div class="alert alert-danger read-num-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="type" class="col-sm-2 control-label">类型</label>
				    <div class="col-sm-10">
	                    <label class="radio-inline">
	                    	<s:if test="msgEdit.type == 'adv'.toString()">
	                    		<input type="radio" id="type" value="adv" name="msgEdit.type" checked="true"> 广告
				    		</s:if>
				    		<s:else>
				    			<input type="radio" id="type" value="adv" name="msgEdit.type"> 广告
				    		</s:else>
	                    </label>
	                    <label class="radio-inline">
	                    	<s:if test="msgEdit.type == 'news'.toString()">
	                    		<input type="radio" id="type" value="news" name="msgEdit.type" checked="true"> 新闻
				    		</s:if>
				    		<s:else>
				    			<input type="radio" id="type" value="news" name="msgEdit.type"> 新闻
				    		</s:else>
	                    </label>
	                    <label class="radio-inline">
	                    	<s:if test="msgEdit.type == 'bc'.toString()">
	                    		<input type="radio" id="type" value="bc" name="msgEdit.type" checked="true"> 广播
				    		</s:if>
				    		<s:else>
				    			<input type="radio" id="type" value="bc" name="msgEdit.type"> 广播
				    		</s:else>
	                    </label>
					    <div class="alert alert-danger type-msg" role="alert" style="margin-bottom:0;display:none;"></div>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="is_show" class="col-sm-2 control-label">类型</label>
				    <div class="col-sm-10">
	                    <label class="radio-inline">
	                    	<s:if test="msgEdit.is_show == 1">
	                    		<input type="radio" id="is_show" value="1" name="msgEdit.is_show" checked="true"> 显示
				    		</s:if>
				    		<s:else>
				    			<input type="radio" id="is_show" value="1" name="msgEdit.is_show"> 显示
				    		</s:else>
	                    </label>
	                    <label class="radio-inline">
	                    	<s:if test="msgEdit.is_show == 0">
	                    		<input type="radio" id="is_show" value="0" name="msgEdit.is_show" checked="true"> 隐藏
				    		</s:if>
				    		<s:else>
				    			<input type="radio" id="is_show" value="0" name="msgEdit.is_show"> 隐藏
				    		</s:else>
	                    </label>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="is_top" class="col-sm-2 control-label">类型</label>
				    <div class="col-sm-10">
	                    <label class="radio-inline">
	                    	<s:if test="msgEdit.is_top == 0">
	                    		<input type="radio" id="is_top" value="0" name="msgEdit.is_top" checked="true"> 普通
				    		</s:if>
				    		<s:else>
				    			<input type="radio" id="is_top" value="0" name="msgEdit.is_top"> 普通
				    		</s:else>
	                    </label>
	                    <label class="radio-inline">
	                    	<s:if test="msgEdit.is_top == 1">
	                    		<input type="radio" id="is_top" value="1" name="msgEdit.is_top" checked="true"> 置顶
				    		</s:if>
				    		<s:else>
				    			<input type="radio" id="is_top" value="1" name="msgEdit.is_top"> 置顶
				    		</s:else>
	                    </label>
				    </div>
				  </div>
				  <div class="form-group">
				    <div class="col-sm-offset-2 col-sm-10">
				      <div onclick="submit()" class="btn btn-default">修改</div>
				      <button class="btn btn-warning" onclick="history.go(-1)">取消</button>
				    </div>
				  </div>
				</form>
            </div>
        </div>
	<jsp:include page="../common/footer.jsp"></jsp:include>
    <script src="http://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
    <script src="http://cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <script src="/dld/admin/js/template_js.js"></script>
    <!-- 配置文件 -->
    <script type="text/javascript" src="/ueditor1_4_3_3-utf8-jsp/ueditor.config.js"></script>
    <!-- 编辑器源码文件 -->
    <script type="text/javascript" src="/ueditor1_4_3_3-utf8-jsp/ueditor.all.js"></script>
    <!-- 实例化编辑器 -->
    <script type="text/javascript">
    var editor = UE.getEditor('content', {
        initialFrameHeight: 450,
    });
    
    function submit(){
        if($('#title').val() == ''){
        	$('.title-msg').show();
        	$('.title-msg').text('请输入内容！');
        	return;
        }else{
        	$('.title-msg').hide();
        }
        if($('#read_num').val() < 0){
        	$('.read-num-msg').show();
        	$('.read-num-msg').text('必须大于等于0！');
        	return;
        }else{
        	$('.read-num-msg').hide();
        }
        if($('#type:checked').val() == ''){
        	$('.type-msg').show();
        	$('.type-msg').text('请选择类型！');
        	return;
        }else{
        	$('.type-msg').hide();
        }
    	$('.form-horizontal').submit();
    }
    </script>
</body>

</html>